<?php

	class RefererModel extends EbTableSQLModel
	{

		public function __construct()
		{
			parent::init('an_referer','Analysis/RefererVO','referer_id');
		}
		
		public function getColumns()
		{
			return array(
				new EbTableColumn('referer_id','INT',true,1,true),
				new EbTableColumn('url','VARCHAR(64)',true,0,false),
				new EbTableColumn('hits','INT',true,0,false)
			);
		}
		
		public function insert($vo)
		{
			$vo->url = substr($vo->url,0,64);
			
			if (strpos($vo->url,'http://'.EbApplication::getConfig('host','localhost')) === false)
			{
				return parent::insert($vo);
			}
			else
			{
				return false;
			}
		}
		
	}